<!-- 评论组件 -->
<template>
  <div>
    <p>{{ tilleName }}</p>
    <div id="typesetting">
      <div v-for="item in listDate" :key="item.id">
        <img :src="item.img" alt="" />
        <div>{{ item.title }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  props: ["tilleName"],
  async created() {
    let re = "";
    if (this.tilleName == "热门推荐") {//判断是哪一个部分，需要那一些数据
      //接收数据
      re = await axios.get("http://localhost:3000/recommmed");
    } else {
      re = await axios.get("http://localhost:3000/hotProduct");
    }
    this.listDate = re.data;
  },
  data() {
    return {
      listDate: [],
    };
  },
};
</script>

<style lang="less" scoped>
p{
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.2rem;
}
#typesetting {
  height: 15vh;
  width: 90vw;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-radius: 2%;
  box-shadow: 1px 1px 2px 2px rgb(238, 236, 236);
  background-color: #ffffff;
  div {
    border-radius: 50%;
    font-size: 0.8rem;
    img {
      width: 15vw;
      height: 15vw;
    }
  }
}
</style>